﻿using System;
using Microsoft.Practices.ServiceLocation;

namespace Caramel.Cqrs
{
	public static class Event
	{
		public static void Raise<TEvent>(TEvent @event) 
			where TEvent : class, IEvent
		{
			foreach (var handler in ServiceLocator.Current.GetAllInstances<IEventHandler<TEvent>>())
			{
				handler.Handle(@event);
			}
		}
	}
}
